<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| This file is where you may define all of the routes that are handled
| by your application. Just tell Laravel the URIs it should respond
| to using a Closure or controller method. Build something great!
|
*/
Route::any('/', function () {
    return redirect('/admin');
});

//前台用户
Route::get('login', 'Web\LoginController@showLoginForm')->name('login');
Route::post('login', 'Web\LoginController@login');
Route::get('logout', 'Web\LoginController@logout');
Route::post('logout', 'Web\LoginController@logout');

//验证码
Route::get('/index/captcha/{tmp}', 'RegisterController@captcha');

//Route::get('/', 'Web\IndexController@index');
//跳转路由
Route::get('weblogin/{id}', 'Web\LoginController@weblogin');

//
Route::group(['middleware' => ['auth:web', 'auth']], function () {
	
	//修改密码
	Route::any('user/passupdate/{id}/{pass}', ['uses' => 'Web\UserController@passupdate']);
	
	//修改头像
	Route::post('user/picupdate', ['uses' => 'Web\UserController@picupdate']);
	Route::post('user/picurl/{id}', ['uses' => 'Web\UserController@picurl']);
    
    //商品路由
    Route::get('goods/index', ['uses' => 'Web\GoodsController@index']);  //商品列表
    Route::post('goods/index', ['uses' => 'Web\GoodsController@index']);
    Route::get('goods/buy/{id}', ['uses' => 'Web\GoodsController@buy']);
	Route::get('goods/details/{id}',['uses' => 'Web\GoodsController@details']);   //商品详情

    //订单路由
    Route::get('order/index', ['uses' => 'Web\OrderController@index']);  //商品列表
    Route::post('order/index', ['uses' => 'Web\OrderController@index']);
    Route::get('order/buy/{id}', ['uses' => 'Web\OrderController@buy']);
    Route::any('order/del/{id}', ['uses' => 'Web\OrderController@del']);


    //提交订单
    Route::post('ajax/submit/order', ['uses' => 'Web\OrderController@submitOrder']);

    //费用明细列表
    Route::get('cost/index', ['uses' => 'Web\CostController@index']);
    Route::post('cost/index', ['uses' => 'Web\CostController@index']);

    //新闻列表
    Route::any('news/index', ['uses' => 'Web\NewsController@news']);
    Route::get('help/index', ['uses' => 'Web\NewsController@help']);
    Route::get('about/index', ['uses' => 'Web\NewsController@about']);
    Route::any('log/index', ['uses' => 'Web\NewsController@log']);
    Route::any('log/loadlog/{id}', ['uses' => 'Web\NewsController@loadLog']);
    Route::get('articles/view/{id}', ['uses' => 'Web\NewsController@view']);

    //财务明细
    Route::any('wallet/index', ['uses' => 'Web\CostController@wallet']);
    Route::any('donation/index', ['uses' => 'Web\CostController@donation']);
    
    //个人中心
    Route::any('member/index', ['uses' => 'Web\MemberController@index']);
    
});

